<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<table width="100%">
	<tr align="center" class="firstrowtable">
		<td><strong>First name</strong></td>
		<td><strong>Last name</strong></td>
		<td><strong>Email</strong></td>
		<td><strong>Phone number</strong></td>
		<td><strong>Roles</strong></td>
		<td><strong>Enable</strong></td>
		<td><strong>Edit</strong></td>
		<td><strong>Delete</strong></td>
		<td><strong>Details</strong></td>
		<td><strong>Status</strong></td>
	</tr>
	<c:forEach var ="item" items ="${requestScope.users}">
	<tr>
		
		<td>${item.firstname}</td>
		<td>${item.lastname}</td>
		<td>${item.email}</td>
		<td>${item.phonenumber}</td>
		<td>${item.userroles.roles}</td>
		<td>${item.enable}</td>
		<c:if test = "${item.userroles.roles.equals('ROLE_ADMIN')}">
		<td align="center"><a href="EditUserJsp.do?memberid=${item.memberid}&up=1">
							<img src="images/btdegrade.png" alt="#" border="0" /></a></td>
		</c:if>
		<c:if test = "${item.userroles.roles.equals('ROLE_USER')}">
		<td align="center"><a href="EditUserJsp.do?memberid=${item.memberid}&up=2">
							<img src="images/btupgrade.png" alt="#" border="0" /></a></td>
		</c:if>

							
		<td align="center"><a href ="DeleteUser.do?memberid=${item.memberid}" onclick="return confirm('Are you sure you want to delete?')"><img src="images/btdelete.png" alt="#" border="0" /></a></td>

		<td align="center"><a href ="DetailsUser.do?memberid=${item.memberid}"><img src="images/btdetails.png" alt="#" border="0" /></a></td>
		<c:if test ="${item.enable == true}">
			<td align="center"><a href ="BlockUser.do?memberid=${item.memberid}&enable=1"><img src="images/btdisable.png" alt="#" border="0" /></a></td>
		</c:if>
		<c:if test ="${item.enable == false}">
			<td align="center"><a href ="BlockUser.do?memberid=${item.memberid}&enable=0"><img src="images/btenable.png" alt="#" border="0" /></a></td>
		</c:if>
	</tr>
	</c:forEach>
</table>